var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var BundleConfig = require("AA_BundleConfig");
var EventManager = require("AA_EventManager");
var UIManager = require("AA_UIManager");
var TimeUtils = require("AA_TimeUtils");
var EvenType = require("AA_EvenType");
var PlayerDataManager = require("AA_PlayerDataManager");
var GameDataManager = require("AA_GameDataManager");
var GameGlobalVariable = require("AA_GameGlobalVariable");
var UIConfig_Home = require("AA_UIConfig_Home");
var BaseModule = require("AA_BaseModule");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_Module_News = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.wujintime = null;
    t.wujincount = null;
    t.wujinLock = null;
    t.jiesuoTip = null;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype.onEnable = function () {
    EventManager.EventMgr.addEventListener(EvenType.EVENT_TYPE.GAME_TIAOZHAN_COUNT, this.initWuJinUi, this);
    this.initWuJinUi();
    if (-1 == GameGlobalVariable.GameGlobalVariable.nowlevel) {
      this.showTiaoZhan();
      GameGlobalVariable.GameGlobalVariable.nowlevel = 1;
    }
  };
  _creator.prototype.onDisable = function () {
    EventManager.EventMgr.rmEventListener(EvenType.EVENT_TYPE.GAME_TIAOZHAN_COUNT, this.initWuJinUi, this);
  };
  _creator.prototype.show = function () {
    this.initWuJinUi();
  };
  _creator.prototype.hide = function () {};
  _creator.prototype.initWuJinUi = function () {
    this.jiesuoTip.string = "通关第" + GameGlobalVariable.GameGlobalVariable.wujinunlockcount + "章解锁";
    if (GameDataManager.GameDataMgr.getNowMaxLevel() >= GameGlobalVariable.GameGlobalVariable.wujinunlockcount) {
      this.wujinLock.active = false;
    } else {
      this.wujinLock.active = true;
    }
    var e = PlayerDataManager.PlayerDataMgr.getWuJinCount();
    this.wujincount.string = "今日剩余" + e + "次";
  };
  _creator.prototype.showTiaoZhan = function () {
    UIManager.default.open(BundleConfig.BundleNames.Home, UIConfig_Home.UIView_Home.UI_WuJinTiaoZhan);
  };
  _creator.prototype.showTip = function () {
    UIManager.default.open(BundleConfig.BundleNames.Home, UIConfig_Home.UIView_Home.UI_ShuoMing);
  };
  _creator.prototype.update = function () {
    this.wujintime.string = TimeUtils.default.secondsToHMS(TimeUtils.default.getTimeUntilMidnight() / 1e3);
  };
  __decorate([_property(cc.Label)], _creator.prototype, "wujintime", undefined);
  __decorate([_property(cc.Label)], _creator.prototype, "wujincount", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "wujinLock", undefined);
  __decorate([_property(cc.Label)], _creator.prototype, "jiesuoTip", undefined);
  return __decorate([_ccclass], _creator);
}(BaseModule.default);
exports.default = _def_Module_News;